// hyb_yl/backstageServices/pages/drupmespay/drupmespay.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    wenzhenpop:false,
    argeen:false,
    pay:"",
    noticedif:false,
    ifaddress:false,
    addressmes:{},
    num:1,
    totals:20,
    price: 20,
    steps: ["上传处方", "完善信息", "选择药品", "医生开药"],
    stepnum: 2,
    copyright: [
      { imgs: "https://6a69-jin5201-a4503e-1257013711.tcb.qcloud.la/renzheng.png?sign=99d87d2d65c67c848a10aaf43bafb66e&t=1583825248", text: "药监认证" },
      { imgs: "https://6a69-jin5201-a4503e-1257013711.tcb.qcloud.la/people.png?sign=717fc4019448bfc2a03ac538022f7ed8&t=1583825298", text: "药师审核" },
      { imgs: "https://6a69-jin5201-a4503e-1257013711.tcb.qcloud.la/yinsi.png?sign=f45888dbb9b06874e8d079f99d6018f5&t=1583825342", text: "隐私包装" },
    ]
  },
  //问诊协议
  wenzhenclick(){
    this.setData({
      wenzhenpop: true
    })
  },
  meknow(){
    this.setData({
      wenzhenpop: false
    })
  },
  // 是否同意协议
  radioChange() {
    this.setData({
      argeen: !this.data.argeen
    })
  },
  closewenzhenpop(){

  },
  // 注意事项
  noticedclick(){
    this.setData({
      noticedif:true
    })
  },
  closepop(){
    this.setData({
      noticedif: false
    })
  },
  //支付按钮
  paybtn() {
    wx.showModal({
      title: '是否支付',
      success: function (res) {
        if (res.confirm) {
          wx.navigateTo({
            url: '/hyb_yl/zhuanjiasubpages/pages/zhifuend/zhifuend?txt=yes',
          })
        } else {
          wx.navigateTo({
            url: '/hyb_yl/zhuanjiasubpages/pages/zhifuend/zhifuend?txt=no',
          })
        }
      }
    })
    // wx.requestPayment({
    //   timeStamp: '',
    //   nonceStr: '',
    //   package: '',
    //   signType: '',
    //   paySign: '',
    // })
  },
  //加减
  aasbtnclick(e){
    let types = e.currentTarget.dataset.types, num = this.data.num, totals = this.data.totals, price = this.data.price
    if (types=='a'){
      ++num
    }else{
      num=num>1?--num:1
    }
    this.setData({
      num,
      totals: price * num
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    this.setData({
      pay: options.pay
    })
  },
  //添加地址
  address(){
    let self = this;
    wx.chooseAddress({
      success(res){
        let obj = {
          name: res.userName,
          tell: res.telNumber,
          site: res.provinceName + res.cityName + res.countyName + res.detailInfo
        }
        self.setData({
          ifaddress: true,
          addressmes: obj
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})